package com.yiqi.lottery.feature.mine.model;

import com.luck.picture.lib.rxbus2.RxBus;
import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.lottery.entity.bo.BalanceBo;
import com.yiqi.lottery.entity.bo.PayStautsBo;
import com.yiqi.lottery.entity.bo.RechargeBo;
import com.yiqi.lottery.entity.bo.RechargeCallBackBo;
import com.yiqi.lottery.feature.mine.contract.BanlanceContract;
import com.yiqi.lottery.feature.mine.contract.RechargeContract;
import com.yiqi.lottery.feature.mine.dependencies.banlance.DaggerBanlanceModelComponent;
import com.yiqi.lottery.feature.mine.dependencies.recharge.DaggerRechargeModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.UserApi;
import io.reactivex.Observable;

import javax.inject.Inject;

public class RechargeModel implements RechargeContract.Model {

    @Inject
    UserApi api;


    @Inject
    public RechargeModel() {

        DaggerRechargeModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<RechargeBo> toRecharge(RechargeBo rechargeBo) {
        return api.toRecharge(rechargeBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<RechargeBo> toWithdraw(RechargeBo rechargeBo) {
        return api.toWithdraw(rechargeBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<PayStautsBo> toYLPay(String id) {
        return api.getYLPay(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<UserInfoBo> getUsertInfo() {
        return api.getUserInfo().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
